/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package protocol;

import org.w3c.dom.Element;

/**
 *
 * @author radu
 */
public class MessageConnectRep extends Message {

    boolean allowed;

    public MessageConnectRep(Element root) {
        //TODO : more testing
        if(root.getAttribute("allowed").trim().equals("yes")) {
            allowed  = true;
        } else {
            allowed = false;
        }
    }

    public MessageConnectRep(boolean _allowed) {
        allowed = _allowed;
    }

    @Override
    public String toString() {
        if(allowed){
            return "<connected allowed=\"yes\"></connected>\r\n";
        }else {
            return "<connected allowed=\"no\"></connected>\r\n";
        }
        
    }

    @Override
    public Executor getServerExecutor() {
        return null;//new ExecutorConnect(this);
    }

    public boolean isAllowed() {
        return allowed;
    }
    
}
